﻿/* ----------------------------------------------------------------------------
 * Copyright (c) Philip Stears 
 *
 * This source code is subject to terms and conditions of the Microsoft Public 
 * License (Ms-PL).
 * 
 * By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 * 
 * To request a copy of the Microsoft Public License, send a request by email
 * to license@connectbasic.net.
 *
 * This notice must not be removed from this software.
 * ---------------------------------------------------------------------------- */

namespace ConnectBasic.Shell.Hosting
{
    using System;

    /// <summary>
    /// Provides support for passing in creation 
    /// parameters to a shell host via the <see cref="ShellFactory" />.
    /// </summary>
    public class ShellHostSettings
    {
        private bool mIsLocked;        

        /// <summary>
        /// Locks the object to prevent further 
        /// modifications.
        /// </summary>
        public void Lock()
        {
            mIsLocked = true;
        }

        /// <summary>
        /// Determines whether the object has been locked
        /// to prevent further modification.
        /// </summary>
        public bool IsLocked
        {
            get { return mIsLocked; }
        }

        #region Helpers

        /// <summary>
        /// Throws an instance of the <see cref="InvalidOperationException" /> class if the 
        /// object is locked.
        /// </summary>
        private void AssertUnlocked()
        {
            if (mIsLocked)
            {
                throw new InvalidOperationException(Properties.Resources.ExInvOp_Locked);
            }
        }

        #endregion

    }
}
